<?php

namespace Database\Seeders;

use App\Models\Role;
use App\Models\User;
use Illuminate\Database\Seeder;

class UserSeeder extends Seeder
{
  /**
   * Run the database seeds.
   */
  public function run()
  {
    // admin
    $adminRole = Role::where('slug', 'admin')->first();
    $admin = new User();
    $admin->name = 'Francisco Ramon';
    $admin->email = 'francisco.ramon@starlab.com';
    $admin->password = 'iamthevibe';
    $admin->role_id = $adminRole->id;
    $admin->save();
    // editor
    $editorRole = Role::where('slug', 'editor')->first();
    $editor = new User();
    $editor->name = 'Barry Allen';
    $editor->email = 'barry.allen@ccpd.com';
    $editor->password = 'iamtheflash';
    $editor->role_id = $editorRole->id;
    $editor->save();
    // readers
    $readerRole = Role::where('slug', 'reader')->first();
    $reader = new User();
    $reader->name = 'Central City Citizen';
    $reader->email = 'info@cccitizen.com';
    $reader->password = 'bestnewspaper';
    $reader->role_id = $readerRole->id;
    $reader->save();
    $reader2 = new User();
    $reader2->name = 'Wally West';
    $reader2->email = 'wally.west@starlab.com';
    $reader2->password = 'iamkidflash';
    $reader2->role_id = $readerRole->id;
    $reader2->save();
  }
}
